package com.itheima.springbootmybatis.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Objects;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "student")
public class Student  {
   // private Integer id ;
    private String name ;
  /*  private Integer age ;
    private  Integer sex ;*/


    public QueryWrapper<Student> toQueryWrapperBeforeSave() {
        QueryWrapper<Student> queryWrapper = new QueryWrapper<>();

        queryWrapper.eq("name", this.name);
        return queryWrapper;
    }


    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(name, student.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }
}
